package com.sesame;

import com.github.kevinsawicki.http.HttpRequest;

import java.util.HashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) throws Exception {
        test1();
        System.out.println("#############################");
        test2();
    }

    public static void test1() {
        String url = "http://127.0.0.1:8056/index/test1";
        Map params = new HashMap();
        params.put("name", "张三");
        String res = HttpRequest.post(url).form(params).body();
        System.out.println(res);
    }

    public static void test2() throws Exception {
        String url = "http://127.0.0.1:8056/index/test2";
        Map<String,String> params = new HashMap<>();
        params.put("name", "李四");

        String public_token = "auth-h5";
        String private_key = "user1";
        String dynamic_token = "";// AuthTokenUtils.getAuthToken_s(public_token, private_key, 1);

        Map<String, String> header = new HashMap<>();
//        header.put(AuthTokenUtils.PUBLIC_TOKEN_KEY, public_token);
//        header.put(AuthTokenUtils.DYNAMIC_TOKEN_KEY, dynamic_token);
        System.out.println(url);
        System.out.println(header);
        String res2 = HttpRequest.post(url).headers(header).form(params).body();
        System.out.println(res2);
    }


}
